{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Numpy and Pandas.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "EgrClAlpC8s-",
        "colab_type": "text"
      },
      "source": [
        "# Python Basic operations"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ZuQjJSf9C0ko",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "0289376d-5b39-4737-9ea4-c0e8897fc8f3"
      },
      "source": [
        "class Disease:\n",
        "  def __init__(self, disease = 'Depression'):\n",
        "    self.type = disease\n",
        "    \n",
        "  def getName(self):\n",
        "    print(\"Mental Health Diseases: {0}\".format(self.type))\n",
        "\n",
        "d1 = Disease('Social Anxiety Disorder')\n",
        "d1.getName()"
      ],
      "execution_count": 1,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Mental Health Diseases: Social Anxiety Disorder\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "kTyrcThEDCIU",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "65d7db92-cd4f-448b-bb59-a1cd1a011845"
      },
      "source": [
        "# Try Catch Block\n",
        "# The try block will generate a NameError, because x is not defined:\n",
        "\n",
        "try:\n",
        "  print(y)\n",
        "except NameError:\n",
        "  print(\"Well, the variable y is not defined\")\n",
        "except:\n",
        "  print(\"OMG, Something else went wrong\")\n"
      ],
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Well, the variable y is not defined\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "iGbKigYzD4rM",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 51
        },
        "outputId": "c1270b91-ce4b-42b2-b8f0-53edf3c0e7b6"
      },
      "source": [
        "\n",
        "try:\n",
        " Value = int(input(\"Type a number between 1 and 10:\"))\n",
        "except ValueError:\n",
        "  print(\"You must type a number between 1 and 10!\")\n",
        "else:\n",
        "  if (Value > 0) and (Value <= 10):\n",
        "      print(\"You typed: \", Value)\n",
        "  else:\n",
        "      print(\"The value you typed is incorrect!\")\n"
      ],
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Type a number between 1 and 10:333\n",
            "The value you typed is incorrect!\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "xNPYSP_aDxgz",
        "colab_type": "text"
      },
      "source": [
        "# Numpy Array Basics"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "GVMckxhaDsrH",
        "colab_type": "code",
        "outputId": "e2a06eb3-b689-4e96-e66c-aefb8f740a53",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 170
        }
      },
      "source": [
        "# importing numpy\n",
        "import numpy as np\n",
        "\n",
        "# Defining 1D array\n",
        "my1DArray = np.array([1, 8, 27, 64])\n",
        "print(my1DArray)\n",
        "\n",
        "# Defining and printing 2D array\n",
        "my2DArray = np.array([[1, 2, 3, 4], [2, 4, 9, 16], [4, 8, 18, 32]])\n",
        "print(my2DArray)\n",
        "\n",
        "#Defining and printing 3D array\n",
        "my3Darray = np.array([[[ 1, 2 , 3 , 4],[ 5 , 6 , 7  ,8]], [[ 1,  2,  3,  4],[ 9, 10, 11, 12]]])\n",
        "print(my3Darray)\n",
        "\n"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[ 1  8 27 64]\n",
            "[[ 1  2  3  4]\n",
            " [ 2  4  9 16]\n",
            " [ 4  8 18 32]]\n",
            "[[[ 1  2  3  4]\n",
            "  [ 5  6  7  8]]\n",
            "\n",
            " [[ 1  2  3  4]\n",
            "  [ 9 10 11 12]]]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "FOHcYUkkF2u-",
        "colab_type": "code",
        "outputId": "a504d500-aeb6-40cc-aa63-0590900b2a77",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 85
        }
      },
      "source": [
        "# Print out memory address\n",
        "print(my2DArray.data)\n",
        "\n",
        "# Print the shape of array\n",
        "print(my2DArray.shape)\n",
        "\n",
        "# Print out the data type of the array\n",
        "print(my2DArray.dtype)\n",
        "\n",
        "\"\"\"\n",
        "Print the stride of the array.\n",
        "\n",
        "So what is stride of array?  It is the number of locations in memory between \n",
        "beginnings of successive array elements, measured in bytes or in units of the\n",
        "size of the array's elements\n",
        "\"\"\"\n",
        "print(my2DArray.strides)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "<memory at 0x7f0477c79048>\n",
            "(3, 4)\n",
            "int64\n",
            "(32, 8)\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "_tan6CTdpvH3",
        "colab_type": "text"
      },
      "source": [
        "# Array using numpy built-in functions"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "hXg80w6Wpsqd",
        "colab_type": "code",
        "outputId": "c19ade55-5dcd-4477-c7bb-f57e566d6cd4",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 306
        }
      },
      "source": [
        "# Array of ones\n",
        "ones = np.ones((3,4))\n",
        "print(ones)\n",
        "\n",
        "# Array of zeros\n",
        "zeros = np.zeros((2,3,4),dtype=np.int16)\n",
        "print(zeros)\n",
        "\n",
        "# Array with random values\n",
        "np.random.random((2,2))\n",
        "\n",
        "# Empty array\n",
        "emptyArray = np.empty((3,2))\n",
        "print(emptyArray)\n",
        "\n",
        "# Full array\n",
        "fullArray = np.full((2,2),7)\n",
        "print(fullArray)\n",
        "\n",
        "# Array of evenly-spaced values\n",
        "evenSpacedArray = np.arange(10,25,5)\n",
        "print(evenSpacedArray)\n",
        "\n",
        "# Array of evenly-spaced values\n",
        "evenSpacedArray2 = np.linspace(0,2,9)\n",
        "print(evenSpacedArray2)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[[1. 1. 1. 1.]\n",
            " [1. 1. 1. 1.]\n",
            " [1. 1. 1. 1.]]\n",
            "[[[0 0 0 0]\n",
            "  [0 0 0 0]\n",
            "  [0 0 0 0]]\n",
            "\n",
            " [[0 0 0 0]\n",
            "  [0 0 0 0]\n",
            "  [0 0 0 0]]]\n",
            "[[2.18282866e-316 4.94065646e-324]\n",
            " [4.94065646e-324 0.00000000e+000]\n",
            " [0.00000000e+000 0.00000000e+000]]\n",
            "[[7 7]\n",
            " [7 7]]\n",
            "[10 15 20]\n",
            "[0.   0.25 0.5  0.75 1.   1.25 1.5  1.75 2.  ]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0VMNmT2BqjtF",
        "colab_type": "text"
      },
      "source": [
        "# Numpy array and file operations"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "87k4xazaqeD7",
        "colab_type": "code",
        "outputId": "37d23b09-4830-4330-c115-73a0cf87f0bd",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 139
        }
      },
      "source": [
        "# Save a numpy array into file\n",
        "x = np.arange(0.0,50.0,1.0)\n",
        "np.savetxt('data.out', x, delimiter=',')\n",
        "\n",
        "# Loading numpy array from text\n",
        "z = np.loadtxt('data.out', unpack=True)\n",
        "print(z)\n",
        "\n",
        "# Loading numpy array using genfromtxt method\n",
        "my_array2 = np.genfromtxt('data.out',\n",
        "                      skip_header=1,\n",
        "                      filling_values=-999)\n",
        "print(my_array2)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[ 0.  1.  2.  3.  4.  5.  6.  7.  8.  9. 10. 11. 12. 13. 14. 15. 16. 17.\n",
            " 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35.\n",
            " 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49.]\n",
            "[ 1.  2.  3.  4.  5.  6.  7.  8.  9. 10. 11. 12. 13. 14. 15. 16. 17. 18.\n",
            " 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36.\n",
            " 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49.]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "laHX9HM7rd_h",
        "colab_type": "text"
      },
      "source": [
        "# Inspecting numpy arrays\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "hus66cO8rlm6",
        "colab_type": "code",
        "outputId": "8944dcdd-e851-4d07-bac7-4b11b1539b27",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 204
        }
      },
      "source": [
        "# Print the number of `my2DArray`'s dimensions\n",
        "print(my2DArray.ndim)\n",
        "\n",
        "# Print the number of `my2DArray`'s elements\n",
        "print(my2DArray.size)\n",
        "\n",
        "# Print information about `my2DArray`'s memory layout\n",
        "print(my2DArray.flags)\n",
        "\n",
        "# Print the length of one array element in bytes\n",
        "print(my2DArray.itemsize)\n",
        "\n",
        "# Print the total consumed bytes by `my2DArray`'s elements\n",
        "print(my2DArray.nbytes)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "2\n",
            "12\n",
            "  C_CONTIGUOUS : True\n",
            "  F_CONTIGUOUS : False\n",
            "  OWNDATA : True\n",
            "  WRITEABLE : True\n",
            "  ALIGNED : True\n",
            "  WRITEBACKIFCOPY : False\n",
            "  UPDATEIFCOPY : False\n",
            "8\n",
            "96\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "IDr89W2wsHxj",
        "colab_type": "text"
      },
      "source": [
        "# Broadcasting in NumPy\n",
        "Broadcasting is a mechanism that permits `NumPy` to operate with arrays of different shapes when performing arithmetic operations. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "3YfESrnBr4Vz",
        "colab_type": "code",
        "outputId": "fdf4cae0-2c0e-4ced-b73f-d295bf9d6234",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 255
        }
      },
      "source": [
        "# Rule 1: Two dimensions are operatable if they are equal\n",
        "# Create an array of two dimension\n",
        "A =np.ones((6, 8))\n",
        "\n",
        "# Shape of A\n",
        "print(A.shape)\n",
        "\n",
        "# Create another array\n",
        "B = np.random.random((6,8))\n",
        "\n",
        "# Shape of B\n",
        "print(B.shape)\n",
        "\n",
        "# Sum of A and B, here the shape of both the matrix is same.\n",
        "print(A + B)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "(6, 8)\n",
            "(6, 8)\n",
            "[[1.64613513 1.81218169 1.73277236 1.57617341 1.82402347 1.74772911\n",
            "  1.22843733 1.3993954 ]\n",
            " [1.4660033  1.33101593 1.14628103 1.15712902 1.66748722 1.37379544\n",
            "  1.62748161 1.7947295 ]\n",
            " [1.52599628 1.16567587 1.29470105 1.88796265 1.17581034 1.28402744\n",
            "  1.83282509 1.723289  ]\n",
            " [1.53980657 1.5358293  1.7890984  1.60113655 1.1386734  1.66052094\n",
            "  1.90500048 1.69306468]\n",
            " [1.81646704 1.30210421 1.59608074 1.87246912 1.57628331 1.68802283\n",
            "  1.24708731 1.43667052]\n",
            " [1.28634605 1.80769536 1.36572846 1.67252402 1.37322953 1.55805199\n",
            "  1.31193578 1.24668215]]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "_Q2kSDgrtOYa",
        "colab_type": "code",
        "outputId": "1c03730e-e563-4ba4-d80b-fc4b8b185e02",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 170
        }
      },
      "source": [
        "# Rule 2: Two dimensions are also comptable when one of them is 1\n",
        "# Initialize `x`\n",
        "x = np.ones((3,4))\n",
        "print(x)\n",
        "\n",
        "# Check shape of `x`\n",
        "print(x.shape)\n",
        "\n",
        "# Initialize `y`\n",
        "y = np.arange(4)\n",
        "print(y)\n",
        "\n",
        "# Check shape of `y`\n",
        "print(y.shape)\n",
        "\n",
        "# Subtract `x` and `y`\n",
        "x - y "
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[[1. 1. 1. 1.]\n",
            " [1. 1. 1. 1.]\n",
            " [1. 1. 1. 1.]]\n",
            "(3, 4)\n",
            "[0 1 2 3]\n",
            "(4,)\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([[ 1.,  0., -1., -2.],\n",
              "       [ 1.,  0., -1., -2.],\n",
              "       [ 1.,  0., -1., -2.]])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 7
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qiHoL40gu4Kb",
        "colab_type": "code",
        "outputId": "b30df0c7-ff47-4a27-a347-13835a4f7c11",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "# Rule 3: Arrays can be broadcasted together if they are compatible in all dimensions\n",
        "\n",
        "x = np.ones((6,8))\n",
        "y = np.random.random((10, 1, 8))\n",
        "print(x + y)\n",
        "\n",
        "# Analytical question\n",
        "\"\"\"\n",
        "The dimensions of x(6,8) and y(10,1,8) are diffrent. However, it is possible \n",
        "to add them. Why is that? Also, change y(10,2,8) or y(10,1,4) it will \n",
        "give ValueError. Can you find out why?\n",
        "\"\"\""
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[[[1.02819824 1.6661437  1.25074124 1.98188502 1.67576215 1.1141407\n",
            "   1.05525764 1.89361746]\n",
            "  [1.02819824 1.6661437  1.25074124 1.98188502 1.67576215 1.1141407\n",
            "   1.05525764 1.89361746]\n",
            "  [1.02819824 1.6661437  1.25074124 1.98188502 1.67576215 1.1141407\n",
            "   1.05525764 1.89361746]\n",
            "  [1.02819824 1.6661437  1.25074124 1.98188502 1.67576215 1.1141407\n",
            "   1.05525764 1.89361746]\n",
            "  [1.02819824 1.6661437  1.25074124 1.98188502 1.67576215 1.1141407\n",
            "   1.05525764 1.89361746]\n",
            "  [1.02819824 1.6661437  1.25074124 1.98188502 1.67576215 1.1141407\n",
            "   1.05525764 1.89361746]]\n",
            "\n",
            " [[1.00519247 1.69467587 1.74493108 1.01649286 1.27603402 1.66879546\n",
            "   1.58778444 1.54278283]\n",
            "  [1.00519247 1.69467587 1.74493108 1.01649286 1.27603402 1.66879546\n",
            "   1.58778444 1.54278283]\n",
            "  [1.00519247 1.69467587 1.74493108 1.01649286 1.27603402 1.66879546\n",
            "   1.58778444 1.54278283]\n",
            "  [1.00519247 1.69467587 1.74493108 1.01649286 1.27603402 1.66879546\n",
            "   1.58778444 1.54278283]\n",
            "  [1.00519247 1.69467587 1.74493108 1.01649286 1.27603402 1.66879546\n",
            "   1.58778444 1.54278283]\n",
            "  [1.00519247 1.69467587 1.74493108 1.01649286 1.27603402 1.66879546\n",
            "   1.58778444 1.54278283]]\n",
            "\n",
            " [[1.17947289 1.19267446 1.09810831 1.15681195 1.79847927 1.99634615\n",
            "   1.34169815 1.4513772 ]\n",
            "  [1.17947289 1.19267446 1.09810831 1.15681195 1.79847927 1.99634615\n",
            "   1.34169815 1.4513772 ]\n",
            "  [1.17947289 1.19267446 1.09810831 1.15681195 1.79847927 1.99634615\n",
            "   1.34169815 1.4513772 ]\n",
            "  [1.17947289 1.19267446 1.09810831 1.15681195 1.79847927 1.99634615\n",
            "   1.34169815 1.4513772 ]\n",
            "  [1.17947289 1.19267446 1.09810831 1.15681195 1.79847927 1.99634615\n",
            "   1.34169815 1.4513772 ]\n",
            "  [1.17947289 1.19267446 1.09810831 1.15681195 1.79847927 1.99634615\n",
            "   1.34169815 1.4513772 ]]\n",
            "\n",
            " [[1.77657525 1.42893623 1.45768916 1.53390161 1.8934206  1.09735169\n",
            "   1.96093167 1.13343436]\n",
            "  [1.77657525 1.42893623 1.45768916 1.53390161 1.8934206  1.09735169\n",
            "   1.96093167 1.13343436]\n",
            "  [1.77657525 1.42893623 1.45768916 1.53390161 1.8934206  1.09735169\n",
            "   1.96093167 1.13343436]\n",
            "  [1.77657525 1.42893623 1.45768916 1.53390161 1.8934206  1.09735169\n",
            "   1.96093167 1.13343436]\n",
            "  [1.77657525 1.42893623 1.45768916 1.53390161 1.8934206  1.09735169\n",
            "   1.96093167 1.13343436]\n",
            "  [1.77657525 1.42893623 1.45768916 1.53390161 1.8934206  1.09735169\n",
            "   1.96093167 1.13343436]]\n",
            "\n",
            " [[1.44868984 1.88970484 1.82849956 1.67029951 1.77398273 1.29534318\n",
            "   1.85696243 1.01152638]\n",
            "  [1.44868984 1.88970484 1.82849956 1.67029951 1.77398273 1.29534318\n",
            "   1.85696243 1.01152638]\n",
            "  [1.44868984 1.88970484 1.82849956 1.67029951 1.77398273 1.29534318\n",
            "   1.85696243 1.01152638]\n",
            "  [1.44868984 1.88970484 1.82849956 1.67029951 1.77398273 1.29534318\n",
            "   1.85696243 1.01152638]\n",
            "  [1.44868984 1.88970484 1.82849956 1.67029951 1.77398273 1.29534318\n",
            "   1.85696243 1.01152638]\n",
            "  [1.44868984 1.88970484 1.82849956 1.67029951 1.77398273 1.29534318\n",
            "   1.85696243 1.01152638]]\n",
            "\n",
            " [[1.43203476 1.09782224 1.8650536  1.79679117 1.76828582 1.53386677\n",
            "   1.06512781 1.14888762]\n",
            "  [1.43203476 1.09782224 1.8650536  1.79679117 1.76828582 1.53386677\n",
            "   1.06512781 1.14888762]\n",
            "  [1.43203476 1.09782224 1.8650536  1.79679117 1.76828582 1.53386677\n",
            "   1.06512781 1.14888762]\n",
            "  [1.43203476 1.09782224 1.8650536  1.79679117 1.76828582 1.53386677\n",
            "   1.06512781 1.14888762]\n",
            "  [1.43203476 1.09782224 1.8650536  1.79679117 1.76828582 1.53386677\n",
            "   1.06512781 1.14888762]\n",
            "  [1.43203476 1.09782224 1.8650536  1.79679117 1.76828582 1.53386677\n",
            "   1.06512781 1.14888762]]\n",
            "\n",
            " [[1.11721364 1.36074542 1.22978138 1.07701564 1.2661568  1.37413827\n",
            "   1.41684446 1.79816581]\n",
            "  [1.11721364 1.36074542 1.22978138 1.07701564 1.2661568  1.37413827\n",
            "   1.41684446 1.79816581]\n",
            "  [1.11721364 1.36074542 1.22978138 1.07701564 1.2661568  1.37413827\n",
            "   1.41684446 1.79816581]\n",
            "  [1.11721364 1.36074542 1.22978138 1.07701564 1.2661568  1.37413827\n",
            "   1.41684446 1.79816581]\n",
            "  [1.11721364 1.36074542 1.22978138 1.07701564 1.2661568  1.37413827\n",
            "   1.41684446 1.79816581]\n",
            "  [1.11721364 1.36074542 1.22978138 1.07701564 1.2661568  1.37413827\n",
            "   1.41684446 1.79816581]]\n",
            "\n",
            " [[1.79127733 1.48684262 1.65604212 1.14730864 1.67078635 1.57895861\n",
            "   1.10598186 1.009707  ]\n",
            "  [1.79127733 1.48684262 1.65604212 1.14730864 1.67078635 1.57895861\n",
            "   1.10598186 1.009707  ]\n",
            "  [1.79127733 1.48684262 1.65604212 1.14730864 1.67078635 1.57895861\n",
            "   1.10598186 1.009707  ]\n",
            "  [1.79127733 1.48684262 1.65604212 1.14730864 1.67078635 1.57895861\n",
            "   1.10598186 1.009707  ]\n",
            "  [1.79127733 1.48684262 1.65604212 1.14730864 1.67078635 1.57895861\n",
            "   1.10598186 1.009707  ]\n",
            "  [1.79127733 1.48684262 1.65604212 1.14730864 1.67078635 1.57895861\n",
            "   1.10598186 1.009707  ]]\n",
            "\n",
            " [[1.42891771 1.19719906 1.95856739 1.65935471 1.30933796 1.46430924\n",
            "   1.96452655 1.95315441]\n",
            "  [1.42891771 1.19719906 1.95856739 1.65935471 1.30933796 1.46430924\n",
            "   1.96452655 1.95315441]\n",
            "  [1.42891771 1.19719906 1.95856739 1.65935471 1.30933796 1.46430924\n",
            "   1.96452655 1.95315441]\n",
            "  [1.42891771 1.19719906 1.95856739 1.65935471 1.30933796 1.46430924\n",
            "   1.96452655 1.95315441]\n",
            "  [1.42891771 1.19719906 1.95856739 1.65935471 1.30933796 1.46430924\n",
            "   1.96452655 1.95315441]\n",
            "  [1.42891771 1.19719906 1.95856739 1.65935471 1.30933796 1.46430924\n",
            "   1.96452655 1.95315441]]\n",
            "\n",
            " [[1.90992919 1.39201572 1.15546331 1.69603336 1.37293436 1.10187379\n",
            "   1.82464875 1.48617588]\n",
            "  [1.90992919 1.39201572 1.15546331 1.69603336 1.37293436 1.10187379\n",
            "   1.82464875 1.48617588]\n",
            "  [1.90992919 1.39201572 1.15546331 1.69603336 1.37293436 1.10187379\n",
            "   1.82464875 1.48617588]\n",
            "  [1.90992919 1.39201572 1.15546331 1.69603336 1.37293436 1.10187379\n",
            "   1.82464875 1.48617588]\n",
            "  [1.90992919 1.39201572 1.15546331 1.69603336 1.37293436 1.10187379\n",
            "   1.82464875 1.48617588]\n",
            "  [1.90992919 1.39201572 1.15546331 1.69603336 1.37293436 1.10187379\n",
            "   1.82464875 1.48617588]]]\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "'\\nThe dimensions of x(6,8) and y(10,1,8) are diffrent. However, it is possible \\nto add them. Why is that? Also, change y(10,2,8) or y(10,1,4) it will \\ngive ValueError. Can you find out why?\\n'"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 8
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "y37QrG2wwMXR",
        "colab_type": "text"
      },
      "source": [
        "# Numpy and mathematics at work"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "iL_3It22wIxl",
        "colab_type": "code",
        "outputId": "23fae4a2-3b6f-4121-a212-961a184125a0",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 187
        }
      },
      "source": [
        "# Basica operations (+, -, *, /, %)\n",
        "x = np.array([[1, 2, 3], [2, 3, 4]])\n",
        "y = np.array([[1, 4, 9], [2, 3, -2]])\n",
        "\n",
        "# Add two array\n",
        "add = np.add(x, y)\n",
        "print(add)\n",
        "\n",
        "# Subtract two array\n",
        "sub = np.subtract(x, y)\n",
        "print(sub)\n",
        "\n",
        "# Multipley two array\n",
        "mul = np.multiply(x, y)\n",
        "print(mul)\n",
        "\n",
        "# Divide x, y\n",
        "div = np.divide(x,y)\n",
        "print(div)\n",
        "\n",
        "# Calculated the remainder of x and y\n",
        "rem = np.remainder(x, y)\n",
        "print(rem)\n"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[[ 2  6 12]\n",
            " [ 4  6  2]]\n",
            "[[ 0 -2 -6]\n",
            " [ 0  0  6]]\n",
            "[[ 1  8 27]\n",
            " [ 4  9 -8]]\n",
            "[[ 1.          0.5         0.33333333]\n",
            " [ 1.          1.         -2.        ]]\n",
            "[[0 2 3]\n",
            " [0 0 0]]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "FOOhlPsG2Xz4",
        "colab_type": "text"
      },
      "source": [
        "# Subset, Slice, And Index Arrays"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "VaTOwWvJ2Q39",
        "colab_type": "code",
        "outputId": "c849ff83-8b1a-4c07-9825-8f85d7a7fcfa",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 68
        }
      },
      "source": [
        "x = np.array([10, 20, 30, 40, 50])\n",
        "\n",
        "# Select items at index 0 and 1\n",
        "print(x[0:2])\n",
        "\n",
        "# Select item at row 0 and 1 and column 1 from 2D array\n",
        "y = np.array([[ 1,  2,  3,  4], [ 9, 10, 11 ,12]])\n",
        "print(y[0:2, 1])\n",
        "\n",
        "# Specifying conditions\n",
        "biggerThan2 = (y >= 2)\n",
        "print(y[biggerThan2])"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[10 20]\n",
            "[ 2 10]\n",
            "[ 2  3  4  9 10 11 12]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "RoCi1SRZ828a",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Importing pandas\n",
        "import pandas as pd"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ZOM356yE9E5x",
        "colab_type": "text"
      },
      "source": [
        "# Can you set default parameters in Pandas?\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "3H-cxbK69KJK",
        "colab_type": "code",
        "outputId": "29ad6f8c-e3ad-4406-bd22-856dcf7561e1",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "print(\"Pandas Version:\", pd.__version__)\n",
        "\n",
        "pd.set_option('display.max_columns', 500)\n",
        "pd.set_option('display.max_rows', 500)\n"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Pandas Version: 0.24.2\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3NzGxP-39TS9",
        "colab_type": "text"
      },
      "source": [
        "# Data strcutre of pandas\n",
        "\n",
        "\n",
        "*   Series\n",
        "*   DataFrames\n",
        "\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "i_rBemUy9Qjx",
        "colab_type": "code",
        "outputId": "a59a223a-fa30-4047-a82d-cb23929ec6a5",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 445
        }
      },
      "source": [
        "series = pd.Series([2, 3, 7, 11, 13, 17, 19, 23])\n",
        "print(series)\n",
        "\n",
        "# Creating dataframe from Dictionary\n",
        "dict_df = [{'A': 'Apple', 'B': 'Ball'},{'A': 'Aeroplane', 'B': 'Bat', 'C': 'Cat'}]\n",
        "dict_df = pd.DataFrame(dict_df)\n",
        "print(dict_df)\n",
        "  \n",
        "# Creating dataframe from Series\n",
        "series_df = pd.DataFrame({\n",
        "    'A': range(1, 5),\n",
        "    'B': pd.Timestamp('20190526'),\n",
        "    'C': pd.Series(5, index=list(range(4)), dtype='float64'),\n",
        "    'D': np.array([3] * 4, dtype='int64'),\n",
        "    'E': pd.Categorical([\"Depression\", \"Social Anxiety\", \"Bipolar Disorder\", \"Eating Disorder\"]),\n",
        "    'F': 'Mental health',\n",
        "    'G': 'is challenging'\n",
        "})\n",
        "print(series_df)\n",
        "\n",
        "# Creating a dataframe from ndarrays\n",
        "sdf = {\n",
        "    'County':['Østfold', 'Hordaland', 'Oslo', 'Hedmark', 'Oppland', 'Buskerud'],\n",
        "    'ISO-Code':[1,2,3,4,5,6],\n",
        "    'Area': [4180.69, 4917.94, 454.07, 27397.76, 25192.10, 14910.94],\n",
        "    'Administrative centre': [\"Sarpsborg\", \"Oslo\", \"City of Oslo\", \"Hamar\", \"Lillehammer\", \"Drammen\"]\n",
        "    }\n",
        "sdf = pd.DataFrame(sdf)\n",
        "print(sdf)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "0     2\n",
            "1     3\n",
            "2     7\n",
            "3    11\n",
            "4    13\n",
            "5    17\n",
            "6    19\n",
            "7    23\n",
            "dtype: int64\n",
            "           A     B    C\n",
            "0      Apple  Ball  NaN\n",
            "1  Aeroplane   Bat  Cat\n",
            "   A          B    C  D                 E              F               G\n",
            "0  1 2019-05-26  5.0  3        Depression  Mental health  is challenging\n",
            "1  2 2019-05-26  5.0  3    Social Anxiety  Mental health  is challenging\n",
            "2  3 2019-05-26  5.0  3  Bipolar Disorder  Mental health  is challenging\n",
            "3  4 2019-05-26  5.0  3   Eating Disorder  Mental health  is challenging\n",
            "      County  ISO-Code      Area Administrative centre\n",
            "0    Østfold         1   4180.69             Sarpsborg\n",
            "1  Hordaland         2   4917.94                  Oslo\n",
            "2       Oslo         3    454.07          City of Oslo\n",
            "3    Hedmark         4  27397.76                 Hamar\n",
            "4    Oppland         5  25192.10           Lillehammer\n",
            "5   Buskerud         6  14910.94               Drammen\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3nvUnfDWKQnt",
        "colab_type": "text"
      },
      "source": [
        "# Loading a dataset into Pandas DataFrame\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "9wR-aub1KEIj",
        "colab_type": "code",
        "outputId": "260e5181-75cf-4fa8-8f59-708df75fb0c8",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 515
        }
      },
      "source": [
        "import pandas as pd\n",
        "columns = ['age', 'workclass', 'fnlwgt', 'education', 'education_num',\n",
        "    'marital_status', 'occupation', 'relationship', 'ethnicity', 'gender','capital_gain','capital_loss','hours_per_week','country_of_origin','income']\n",
        "df = pd.read_csv('http://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data',names=columns)\n",
        "df.head(10)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>age</th>\n",
              "      <th>workclass</th>\n",
              "      <th>fnlwgt</th>\n",
              "      <th>education</th>\n",
              "      <th>education_num</th>\n",
              "      <th>marital_status</th>\n",
              "      <th>occupation</th>\n",
              "      <th>relationship</th>\n",
              "      <th>ethnicity</th>\n",
              "      <th>gender</th>\n",
              "      <th>capital_gain</th>\n",
              "      <th>capital_loss</th>\n",
              "      <th>hours_per_week</th>\n",
              "      <th>country_of_origin</th>\n",
              "      <th>income</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>39</td>\n",
              "      <td>State-gov</td>\n",
              "      <td>77516</td>\n",
              "      <td>Bachelors</td>\n",
              "      <td>13</td>\n",
              "      <td>Never-married</td>\n",
              "      <td>Adm-clerical</td>\n",
              "      <td>Not-in-family</td>\n",
              "      <td>White</td>\n",
              "      <td>Male</td>\n",
              "      <td>2174</td>\n",
              "      <td>0</td>\n",
              "      <td>40</td>\n",
              "      <td>United-States</td>\n",
              "      <td>&lt;=50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>50</td>\n",
              "      <td>Self-emp-not-inc</td>\n",
              "      <td>83311</td>\n",
              "      <td>Bachelors</td>\n",
              "      <td>13</td>\n",
              "      <td>Married-civ-spouse</td>\n",
              "      <td>Exec-managerial</td>\n",
              "      <td>Husband</td>\n",
              "      <td>White</td>\n",
              "      <td>Male</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>13</td>\n",
              "      <td>United-States</td>\n",
              "      <td>&lt;=50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>38</td>\n",
              "      <td>Private</td>\n",
              "      <td>215646</td>\n",
              "      <td>HS-grad</td>\n",
              "      <td>9</td>\n",
              "      <td>Divorced</td>\n",
              "      <td>Handlers-cleaners</td>\n",
              "      <td>Not-in-family</td>\n",
              "      <td>White</td>\n",
              "      <td>Male</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>40</td>\n",
              "      <td>United-States</td>\n",
              "      <td>&lt;=50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>53</td>\n",
              "      <td>Private</td>\n",
              "      <td>234721</td>\n",
              "      <td>11th</td>\n",
              "      <td>7</td>\n",
              "      <td>Married-civ-spouse</td>\n",
              "      <td>Handlers-cleaners</td>\n",
              "      <td>Husband</td>\n",
              "      <td>Black</td>\n",
              "      <td>Male</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>40</td>\n",
              "      <td>United-States</td>\n",
              "      <td>&lt;=50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>28</td>\n",
              "      <td>Private</td>\n",
              "      <td>338409</td>\n",
              "      <td>Bachelors</td>\n",
              "      <td>13</td>\n",
              "      <td>Married-civ-spouse</td>\n",
              "      <td>Prof-specialty</td>\n",
              "      <td>Wife</td>\n",
              "      <td>Black</td>\n",
              "      <td>Female</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>40</td>\n",
              "      <td>Cuba</td>\n",
              "      <td>&lt;=50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>37</td>\n",
              "      <td>Private</td>\n",
              "      <td>284582</td>\n",
              "      <td>Masters</td>\n",
              "      <td>14</td>\n",
              "      <td>Married-civ-spouse</td>\n",
              "      <td>Exec-managerial</td>\n",
              "      <td>Wife</td>\n",
              "      <td>White</td>\n",
              "      <td>Female</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>40</td>\n",
              "      <td>United-States</td>\n",
              "      <td>&lt;=50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>49</td>\n",
              "      <td>Private</td>\n",
              "      <td>160187</td>\n",
              "      <td>9th</td>\n",
              "      <td>5</td>\n",
              "      <td>Married-spouse-absent</td>\n",
              "      <td>Other-service</td>\n",
              "      <td>Not-in-family</td>\n",
              "      <td>Black</td>\n",
              "      <td>Female</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>16</td>\n",
              "      <td>Jamaica</td>\n",
              "      <td>&lt;=50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>52</td>\n",
              "      <td>Self-emp-not-inc</td>\n",
              "      <td>209642</td>\n",
              "      <td>HS-grad</td>\n",
              "      <td>9</td>\n",
              "      <td>Married-civ-spouse</td>\n",
              "      <td>Exec-managerial</td>\n",
              "      <td>Husband</td>\n",
              "      <td>White</td>\n",
              "      <td>Male</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>45</td>\n",
              "      <td>United-States</td>\n",
              "      <td>&gt;50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>31</td>\n",
              "      <td>Private</td>\n",
              "      <td>45781</td>\n",
              "      <td>Masters</td>\n",
              "      <td>14</td>\n",
              "      <td>Never-married</td>\n",
              "      <td>Prof-specialty</td>\n",
              "      <td>Not-in-family</td>\n",
              "      <td>White</td>\n",
              "      <td>Female</td>\n",
              "      <td>14084</td>\n",
              "      <td>0</td>\n",
              "      <td>50</td>\n",
              "      <td>United-States</td>\n",
              "      <td>&gt;50K</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>42</td>\n",
              "      <td>Private</td>\n",
              "      <td>159449</td>\n",
              "      <td>Bachelors</td>\n",
              "      <td>13</td>\n",
              "      <td>Married-civ-spouse</td>\n",
              "      <td>Exec-managerial</td>\n",
              "      <td>Husband</td>\n",
              "      <td>White</td>\n",
              "      <td>Male</td>\n",
              "      <td>5178</td>\n",
              "      <td>0</td>\n",
              "      <td>40</td>\n",
              "      <td>United-States</td>\n",
              "      <td>&gt;50K</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   age          workclass  fnlwgt   education  education_num  \\\n",
              "0   39          State-gov   77516   Bachelors             13   \n",
              "1   50   Self-emp-not-inc   83311   Bachelors             13   \n",
              "2   38            Private  215646     HS-grad              9   \n",
              "3   53            Private  234721        11th              7   \n",
              "4   28            Private  338409   Bachelors             13   \n",
              "5   37            Private  284582     Masters             14   \n",
              "6   49            Private  160187         9th              5   \n",
              "7   52   Self-emp-not-inc  209642     HS-grad              9   \n",
              "8   31            Private   45781     Masters             14   \n",
              "9   42            Private  159449   Bachelors             13   \n",
              "\n",
              "           marital_status          occupation    relationship ethnicity  \\\n",
              "0           Never-married        Adm-clerical   Not-in-family     White   \n",
              "1      Married-civ-spouse     Exec-managerial         Husband     White   \n",
              "2                Divorced   Handlers-cleaners   Not-in-family     White   \n",
              "3      Married-civ-spouse   Handlers-cleaners         Husband     Black   \n",
              "4      Married-civ-spouse      Prof-specialty            Wife     Black   \n",
              "5      Married-civ-spouse     Exec-managerial            Wife     White   \n",
              "6   Married-spouse-absent       Other-service   Not-in-family     Black   \n",
              "7      Married-civ-spouse     Exec-managerial         Husband     White   \n",
              "8           Never-married      Prof-specialty   Not-in-family     White   \n",
              "9      Married-civ-spouse     Exec-managerial         Husband     White   \n",
              "\n",
              "    gender  capital_gain  capital_loss  hours_per_week country_of_origin  \\\n",
              "0     Male          2174             0              40     United-States   \n",
              "1     Male             0             0              13     United-States   \n",
              "2     Male             0             0              40     United-States   \n",
              "3     Male             0             0              40     United-States   \n",
              "4   Female             0             0              40              Cuba   \n",
              "5   Female             0             0              40     United-States   \n",
              "6   Female             0             0              16           Jamaica   \n",
              "7     Male             0             0              45     United-States   \n",
              "8   Female         14084             0              50     United-States   \n",
              "9     Male          5178             0              40     United-States   \n",
              "\n",
              "   income  \n",
              "0   <=50K  \n",
              "1   <=50K  \n",
              "2   <=50K  \n",
              "3   <=50K  \n",
              "4   <=50K  \n",
              "5   <=50K  \n",
              "6   <=50K  \n",
              "7    >50K  \n",
              "8    >50K  \n",
              "9    >50K  "
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 23
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "hID1TNlKKdB4",
        "colab_type": "code",
        "outputId": "70605ec4-96bc-471b-e68b-e463a7b4bdcc",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 357
        }
      },
      "source": [
        "# Displays the rows, columns, data types and memory used by the dataframe\n",
        "df.info()"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "<class 'pandas.core.frame.DataFrame'>\n",
            "RangeIndex: 32561 entries, 0 to 32560\n",
            "Data columns (total 15 columns):\n",
            "age                  32561 non-null int64\n",
            "workclass            32561 non-null object\n",
            "fnlwgt               32561 non-null int64\n",
            "education            32561 non-null object\n",
            "education_num        32561 non-null int64\n",
            "marital_status       32561 non-null object\n",
            "occupation           32561 non-null object\n",
            "relationship         32561 non-null object\n",
            "ethnicity            32561 non-null object\n",
            "gender               32561 non-null object\n",
            "capital_gain         32561 non-null int64\n",
            "capital_loss         32561 non-null int64\n",
            "hours_per_week       32561 non-null int64\n",
            "country_of_origin    32561 non-null object\n",
            "income               32561 non-null object\n",
            "dtypes: int64(6), object(9)\n",
            "memory usage: 3.7+ MB\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "PBnmb142KfhT",
        "colab_type": "code",
        "outputId": "97b4f5e8-39fc-4a8f-a495-f98a2acbcf81",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "# Displays the no of data points and columns in the dataframe\n",
        "df.shape"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(32561, 15)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 16
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "wib9eVHRLach",
        "colab_type": "code",
        "outputId": "fba855a4-20a9-42b8-d809-1160747b8397",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 122
        }
      },
      "source": [
        "# Display all columns of the dataframe\n",
        "df.columns"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "Index(['age', 'workclass', 'fnlwgt', 'education', 'education_num',\n",
              "       'marital_status', 'occupation', 'relationship', 'ethnicity', 'gender',\n",
              "       'capital_gain', 'capital_loss', 'hours_per_week', 'country_of_origin',\n",
              "       'income'],\n",
              "      dtype='object')"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 17
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "hdOSdNlULdA5",
        "colab_type": "code",
        "outputId": "50b9fe36-9e0e-48aa-a84d-e48f56386a13",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 317
        }
      },
      "source": [
        "# Displays summary statistics for each numerical column in the dataframe\n",
        "df.describe()"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>age</th>\n",
              "      <th>fnlwgt</th>\n",
              "      <th>education_num</th>\n",
              "      <th>capital_gain</th>\n",
              "      <th>capital_loss</th>\n",
              "      <th>hours_per_week</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>count</th>\n",
              "      <td>32561.000000</td>\n",
              "      <td>3.256100e+04</td>\n",
              "      <td>32561.000000</td>\n",
              "      <td>32561.000000</td>\n",
              "      <td>32561.000000</td>\n",
              "      <td>32561.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>mean</th>\n",
              "      <td>38.581647</td>\n",
              "      <td>1.897784e+05</td>\n",
              "      <td>10.080679</td>\n",
              "      <td>1077.648844</td>\n",
              "      <td>87.303830</td>\n",
              "      <td>40.437456</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>std</th>\n",
              "      <td>13.640433</td>\n",
              "      <td>1.055500e+05</td>\n",
              "      <td>2.572720</td>\n",
              "      <td>7385.292085</td>\n",
              "      <td>402.960219</td>\n",
              "      <td>12.347429</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>min</th>\n",
              "      <td>17.000000</td>\n",
              "      <td>1.228500e+04</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>25%</th>\n",
              "      <td>28.000000</td>\n",
              "      <td>1.178270e+05</td>\n",
              "      <td>9.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>40.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>50%</th>\n",
              "      <td>37.000000</td>\n",
              "      <td>1.783560e+05</td>\n",
              "      <td>10.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>40.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>75%</th>\n",
              "      <td>48.000000</td>\n",
              "      <td>2.370510e+05</td>\n",
              "      <td>12.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>45.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>max</th>\n",
              "      <td>90.000000</td>\n",
              "      <td>1.484705e+06</td>\n",
              "      <td>16.000000</td>\n",
              "      <td>99999.000000</td>\n",
              "      <td>4356.000000</td>\n",
              "      <td>99.000000</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                age        fnlwgt  education_num  capital_gain  capital_loss  \\\n",
              "count  32561.000000  3.256100e+04   32561.000000  32561.000000  32561.000000   \n",
              "mean      38.581647  1.897784e+05      10.080679   1077.648844     87.303830   \n",
              "std       13.640433  1.055500e+05       2.572720   7385.292085    402.960219   \n",
              "min       17.000000  1.228500e+04       1.000000      0.000000      0.000000   \n",
              "25%       28.000000  1.178270e+05       9.000000      0.000000      0.000000   \n",
              "50%       37.000000  1.783560e+05      10.000000      0.000000      0.000000   \n",
              "75%       48.000000  2.370510e+05      12.000000      0.000000      0.000000   \n",
              "max       90.000000  1.484705e+06      16.000000  99999.000000   4356.000000   \n",
              "\n",
              "       hours_per_week  \n",
              "count    32561.000000  \n",
              "mean        40.437456  \n",
              "std         12.347429  \n",
              "min          1.000000  \n",
              "25%         40.000000  \n",
              "50%         40.000000  \n",
              "75%         45.000000  \n",
              "max         99.000000  "
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 18
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "sD5KlSfcTd9o",
        "colab_type": "text"
      },
      "source": [
        "# Selecting rows and columns in the dataframe\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "gawQcy80TgJo",
        "colab_type": "code",
        "outputId": "a7dc8519-3e9d-45a3-eb1b-c758076d2f82",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 204
        }
      },
      "source": [
        "# Selects a row\n",
        "df.iloc[10] \n",
        "\n",
        "# Selects 10 rows             \n",
        "df.iloc[0:10]\n",
        "\n",
        "# Selects a range of rows           \n",
        "df.iloc[10:15]            \n",
        "\n",
        " # Selects the last 2 rows\n",
        "df.iloc[-2:]  \n",
        "\n",
        "# Selects every other row in columns 3-5\n",
        "df.iloc[::2, 3:5].head() "
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>education</th>\n",
              "      <th>education_num</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Bachelors</td>\n",
              "      <td>13</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>HS-grad</td>\n",
              "      <td>9</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Bachelors</td>\n",
              "      <td>13</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>9th</td>\n",
              "      <td>5</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>Masters</td>\n",
              "      <td>14</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "    education  education_num\n",
              "0   Bachelors             13\n",
              "2     HS-grad              9\n",
              "4   Bachelors             13\n",
              "6         9th              5\n",
              "8     Masters             14"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 22
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "5UPm1FfxY6Ci",
        "colab_type": "code",
        "outputId": "8faeb4b0-77b1-4e63-84f2-3a8ccce7d096",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 359
        }
      },
      "source": [
        "import pandas as pd\n",
        "import numpy as np\n",
        "\n",
        "np.random.seed(24)\n",
        "df = pd.DataFrame({'F': np.linspace(1, 10, 10)})\n",
        "df = pd.concat([df, pd.DataFrame(np.random.randn(10, 5), columns=list('EDCBA'))],\n",
        "               axis=1)\n",
        "df.iloc[0, 2] = np.nan\n",
        "df"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>F</th>\n",
              "      <th>E</th>\n",
              "      <th>D</th>\n",
              "      <th>C</th>\n",
              "      <th>B</th>\n",
              "      <th>A</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1.0</td>\n",
              "      <td>1.329212</td>\n",
              "      <td>NaN</td>\n",
              "      <td>-0.316280</td>\n",
              "      <td>-0.990810</td>\n",
              "      <td>-1.070816</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>2.0</td>\n",
              "      <td>-1.438713</td>\n",
              "      <td>0.564417</td>\n",
              "      <td>0.295722</td>\n",
              "      <td>-1.626404</td>\n",
              "      <td>0.219565</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>3.0</td>\n",
              "      <td>0.678805</td>\n",
              "      <td>1.889273</td>\n",
              "      <td>0.961538</td>\n",
              "      <td>0.104011</td>\n",
              "      <td>-0.481165</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>4.0</td>\n",
              "      <td>0.850229</td>\n",
              "      <td>1.453425</td>\n",
              "      <td>1.057737</td>\n",
              "      <td>0.165562</td>\n",
              "      <td>0.515018</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>5.0</td>\n",
              "      <td>-1.336936</td>\n",
              "      <td>0.562861</td>\n",
              "      <td>1.392855</td>\n",
              "      <td>-0.063328</td>\n",
              "      <td>0.121668</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>6.0</td>\n",
              "      <td>1.207603</td>\n",
              "      <td>-0.002040</td>\n",
              "      <td>1.627796</td>\n",
              "      <td>0.354493</td>\n",
              "      <td>1.037528</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>7.0</td>\n",
              "      <td>-0.385684</td>\n",
              "      <td>0.519818</td>\n",
              "      <td>1.686583</td>\n",
              "      <td>-1.325963</td>\n",
              "      <td>1.428984</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>8.0</td>\n",
              "      <td>-2.089354</td>\n",
              "      <td>-0.129820</td>\n",
              "      <td>0.631523</td>\n",
              "      <td>-0.586538</td>\n",
              "      <td>0.290720</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>9.0</td>\n",
              "      <td>1.264103</td>\n",
              "      <td>0.290035</td>\n",
              "      <td>-1.970288</td>\n",
              "      <td>0.803906</td>\n",
              "      <td>1.030550</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>10.0</td>\n",
              "      <td>0.118098</td>\n",
              "      <td>-0.021853</td>\n",
              "      <td>0.046841</td>\n",
              "      <td>-1.628753</td>\n",
              "      <td>-0.392361</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "      F         E         D         C         B         A\n",
              "0   1.0  1.329212       NaN -0.316280 -0.990810 -1.070816\n",
              "1   2.0 -1.438713  0.564417  0.295722 -1.626404  0.219565\n",
              "2   3.0  0.678805  1.889273  0.961538  0.104011 -0.481165\n",
              "3   4.0  0.850229  1.453425  1.057737  0.165562  0.515018\n",
              "4   5.0 -1.336936  0.562861  1.392855 -0.063328  0.121668\n",
              "5   6.0  1.207603 -0.002040  1.627796  0.354493  1.037528\n",
              "6   7.0 -0.385684  0.519818  1.686583 -1.325963  1.428984\n",
              "7   8.0 -2.089354 -0.129820  0.631523 -0.586538  0.290720\n",
              "8   9.0  1.264103  0.290035 -1.970288  0.803906  1.030550\n",
              "9  10.0  0.118098 -0.021853  0.046841 -1.628753 -0.392361"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 27
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "jxhzDHBBZcRJ",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Define a function that should color the values that are less than 0 \n",
        "def colorNegativeValueToRed(value):\n",
        "  if value < 0:\n",
        "    color = 'red'\n",
        "  elif value > 0:\n",
        "    color = 'black'\n",
        "  else:\n",
        "    color = 'green'\n",
        "\n",
        "  return 'color: %s' % color"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "y_LyCSgJZftx",
        "colab_type": "code",
        "outputId": "d63c5e6a-d395-41dd-8069-0d4cb7655ab9",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 250
        }
      },
      "source": [
        "s = df.style.applymap(colorNegativeValueToRed, subset=['A','B','C','D','E'])\n",
        "s"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<style  type=\"text/css\" >\n",
              "    #T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col1 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col2 {\n",
              "            color:  green;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col3 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col4 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col5 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col1 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col2 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col3 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col4 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col5 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col1 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col2 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col3 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col4 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col5 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col1 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col2 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col3 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col4 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col5 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col1 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col2 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col3 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col4 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col5 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col1 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col2 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col3 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col4 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col5 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col1 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col2 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col3 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col4 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col5 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col1 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col2 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col3 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col4 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col5 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col1 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col2 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col3 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col4 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col5 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col1 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col2 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col3 {\n",
              "            color:  black;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col4 {\n",
              "            color:  red;\n",
              "        }    #T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col5 {\n",
              "            color:  red;\n",
              "        }</style><table id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >F</th>        <th class=\"col_heading level0 col1\" >E</th>        <th class=\"col_heading level0 col2\" >D</th>        <th class=\"col_heading level0 col3\" >C</th>        <th class=\"col_heading level0 col4\" >B</th>        <th class=\"col_heading level0 col5\" >A</th>    </tr></thead><tbody>\n",
              "                <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col0\" class=\"data row0 col0\" >1</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col1\" class=\"data row0 col1\" >1.32921</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col2\" class=\"data row0 col2\" >nan</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col3\" class=\"data row0 col3\" >-0.31628</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col4\" class=\"data row0 col4\" >-0.99081</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row0_col5\" class=\"data row0 col5\" >-1.07082</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col0\" class=\"data row1 col0\" >2</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col1\" class=\"data row1 col1\" >-1.43871</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col2\" class=\"data row1 col2\" >0.564417</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col3\" class=\"data row1 col3\" >0.295722</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col4\" class=\"data row1 col4\" >-1.6264</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row1_col5\" class=\"data row1 col5\" >0.219565</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col0\" class=\"data row2 col0\" >3</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col1\" class=\"data row2 col1\" >0.678805</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col2\" class=\"data row2 col2\" >1.88927</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col3\" class=\"data row2 col3\" >0.961538</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col4\" class=\"data row2 col4\" >0.104011</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row2_col5\" class=\"data row2 col5\" >-0.481165</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col0\" class=\"data row3 col0\" >4</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col1\" class=\"data row3 col1\" >0.850229</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col2\" class=\"data row3 col2\" >1.45342</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col3\" class=\"data row3 col3\" >1.05774</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col4\" class=\"data row3 col4\" >0.165562</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row3_col5\" class=\"data row3 col5\" >0.515018</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col0\" class=\"data row4 col0\" >5</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col1\" class=\"data row4 col1\" >-1.33694</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col2\" class=\"data row4 col2\" >0.562861</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col3\" class=\"data row4 col3\" >1.39285</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col4\" class=\"data row4 col4\" >-0.063328</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row4_col5\" class=\"data row4 col5\" >0.121668</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col0\" class=\"data row5 col0\" >6</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col1\" class=\"data row5 col1\" >1.2076</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col2\" class=\"data row5 col2\" >-0.00204021</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col3\" class=\"data row5 col3\" >1.6278</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col4\" class=\"data row5 col4\" >0.354493</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row5_col5\" class=\"data row5 col5\" >1.03753</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col0\" class=\"data row6 col0\" >7</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col1\" class=\"data row6 col1\" >-0.385684</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col2\" class=\"data row6 col2\" >0.519818</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col3\" class=\"data row6 col3\" >1.68658</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col4\" class=\"data row6 col4\" >-1.32596</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row6_col5\" class=\"data row6 col5\" >1.42898</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col0\" class=\"data row7 col0\" >8</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col1\" class=\"data row7 col1\" >-2.08935</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col2\" class=\"data row7 col2\" >-0.12982</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col3\" class=\"data row7 col3\" >0.631523</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col4\" class=\"data row7 col4\" >-0.586538</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row7_col5\" class=\"data row7 col5\" >0.29072</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row8\" class=\"row_heading level0 row8\" >8</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col0\" class=\"data row8 col0\" >9</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col1\" class=\"data row8 col1\" >1.2641</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col2\" class=\"data row8 col2\" >0.290035</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col3\" class=\"data row8 col3\" >-1.97029</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col4\" class=\"data row8 col4\" >0.803906</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row8_col5\" class=\"data row8 col5\" >1.03055</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002level0_row9\" class=\"row_heading level0 row9\" >9</th>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col0\" class=\"data row9 col0\" >10</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col1\" class=\"data row9 col1\" >0.118098</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col2\" class=\"data row9 col2\" >-0.0218533</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col3\" class=\"data row9 col3\" >0.0468407</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col4\" class=\"data row9 col4\" >-1.62875</td>\n",
              "                        <td id=\"T_e19a9282_e845_11e9_9521_0242ac1c0002row9_col5\" class=\"data row9 col5\" >-0.392361</td>\n",
              "            </tr>\n",
              "    </tbody></table>"
            ],
            "text/plain": [
              "<pandas.io.formats.style.Styler at 0x7f046d6a8b70>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 49
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "X1hCinxPaHFg",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Let us hightlight max value in the column with green background and min value with orange background\n",
        "def highlightMax(s):\n",
        "    isMax = s == s.max()\n",
        "    return ['background-color: orange' if v else '' for v in isMax]\n",
        "\n",
        "def highlightMin(s):\n",
        "    isMin = s == s.min()\n",
        "    return ['background-color: green' if v else '' for v in isMin]"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "p5EDYgUxau5T",
        "colab_type": "code",
        "outputId": "6403a08c-297a-48f8-d885-f6268d28874d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 250
        }
      },
      "source": [
        "df.style.apply(highlightMax).apply(highlightMin).highlight_null(null_color='red')\n"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<style  type=\"text/css\" >\n",
              "    #T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col0 {\n",
              "            : ;\n",
              "            background-color:  green;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col1 {\n",
              "            background-color:  orange;\n",
              "            : ;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col2 {\n",
              "            : ;\n",
              "            : ;\n",
              "            background-color:  red;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col5 {\n",
              "            : ;\n",
              "            background-color:  green;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row2_col2 {\n",
              "            background-color:  orange;\n",
              "            : ;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row6_col3 {\n",
              "            background-color:  orange;\n",
              "            : ;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row6_col5 {\n",
              "            background-color:  orange;\n",
              "            : ;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row7_col1 {\n",
              "            : ;\n",
              "            background-color:  green;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row7_col2 {\n",
              "            : ;\n",
              "            background-color:  green;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row8_col3 {\n",
              "            : ;\n",
              "            background-color:  green;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row8_col4 {\n",
              "            background-color:  orange;\n",
              "            : ;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row9_col0 {\n",
              "            background-color:  orange;\n",
              "            : ;\n",
              "            : ;\n",
              "        }    #T_08ba610a_e844_11e9_9521_0242ac1c0002row9_col4 {\n",
              "            : ;\n",
              "            background-color:  green;\n",
              "            : ;\n",
              "        }</style><table id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >F</th>        <th class=\"col_heading level0 col1\" >E</th>        <th class=\"col_heading level0 col2\" >D</th>        <th class=\"col_heading level0 col3\" >C</th>        <th class=\"col_heading level0 col4\" >B</th>        <th class=\"col_heading level0 col5\" >A</th>    </tr></thead><tbody>\n",
              "                <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col0\" class=\"data row0 col0\" >1</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col1\" class=\"data row0 col1\" >1.32921</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col2\" class=\"data row0 col2\" >nan</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col3\" class=\"data row0 col3\" >-0.31628</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col4\" class=\"data row0 col4\" >-0.99081</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row0_col5\" class=\"data row0 col5\" >-1.07082</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row1_col0\" class=\"data row1 col0\" >2</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row1_col1\" class=\"data row1 col1\" >-1.43871</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row1_col2\" class=\"data row1 col2\" >0.564417</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row1_col3\" class=\"data row1 col3\" >0.295722</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row1_col4\" class=\"data row1 col4\" >-1.6264</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row1_col5\" class=\"data row1 col5\" >0.219565</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row2_col0\" class=\"data row2 col0\" >3</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row2_col1\" class=\"data row2 col1\" >0.678805</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row2_col2\" class=\"data row2 col2\" >1.88927</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row2_col3\" class=\"data row2 col3\" >0.961538</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row2_col4\" class=\"data row2 col4\" >0.104011</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row2_col5\" class=\"data row2 col5\" >-0.481165</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row3_col0\" class=\"data row3 col0\" >4</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row3_col1\" class=\"data row3 col1\" >0.850229</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row3_col2\" class=\"data row3 col2\" >1.45342</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row3_col3\" class=\"data row3 col3\" >1.05774</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row3_col4\" class=\"data row3 col4\" >0.165562</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row3_col5\" class=\"data row3 col5\" >0.515018</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row4_col0\" class=\"data row4 col0\" >5</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row4_col1\" class=\"data row4 col1\" >-1.33694</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row4_col2\" class=\"data row4 col2\" >0.562861</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row4_col3\" class=\"data row4 col3\" >1.39285</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row4_col4\" class=\"data row4 col4\" >-0.063328</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row4_col5\" class=\"data row4 col5\" >0.121668</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row5_col0\" class=\"data row5 col0\" >6</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row5_col1\" class=\"data row5 col1\" >1.2076</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row5_col2\" class=\"data row5 col2\" >-0.00204021</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row5_col3\" class=\"data row5 col3\" >1.6278</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row5_col4\" class=\"data row5 col4\" >0.354493</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row5_col5\" class=\"data row5 col5\" >1.03753</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row6_col0\" class=\"data row6 col0\" >7</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row6_col1\" class=\"data row6 col1\" >-0.385684</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row6_col2\" class=\"data row6 col2\" >0.519818</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row6_col3\" class=\"data row6 col3\" >1.68658</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row6_col4\" class=\"data row6 col4\" >-1.32596</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row6_col5\" class=\"data row6 col5\" >1.42898</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row7_col0\" class=\"data row7 col0\" >8</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row7_col1\" class=\"data row7 col1\" >-2.08935</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row7_col2\" class=\"data row7 col2\" >-0.12982</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row7_col3\" class=\"data row7 col3\" >0.631523</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row7_col4\" class=\"data row7 col4\" >-0.586538</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row7_col5\" class=\"data row7 col5\" >0.29072</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row8\" class=\"row_heading level0 row8\" >8</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row8_col0\" class=\"data row8 col0\" >9</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row8_col1\" class=\"data row8 col1\" >1.2641</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row8_col2\" class=\"data row8 col2\" >0.290035</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row8_col3\" class=\"data row8 col3\" >-1.97029</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row8_col4\" class=\"data row8 col4\" >0.803906</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row8_col5\" class=\"data row8 col5\" >1.03055</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002level0_row9\" class=\"row_heading level0 row9\" >9</th>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row9_col0\" class=\"data row9 col0\" >10</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row9_col1\" class=\"data row9 col1\" >0.118098</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row9_col2\" class=\"data row9 col2\" >-0.0218533</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row9_col3\" class=\"data row9 col3\" >0.0468407</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row9_col4\" class=\"data row9 col4\" >-1.62875</td>\n",
              "                        <td id=\"T_08ba610a_e844_11e9_9521_0242ac1c0002row9_col5\" class=\"data row9 col5\" >-0.392361</td>\n",
              "            </tr>\n",
              "    </tbody></table>"
            ],
            "text/plain": [
              "<pandas.io.formats.style.Styler at 0x7f047701b470>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 41
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "-cHAMWkfbylZ",
        "colab_type": "code",
        "outputId": "9c37931b-f9ab-4666-c27f-f57955c1c39b",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 304
        }
      },
      "source": [
        "import seaborn as sns\n",
        "\n",
        "cm = sns.light_palette(\"pink\", as_cmap=True)\n",
        "\n",
        "s = df.style.background_gradient(cmap=cm)\n",
        "s"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/usr/local/lib/python3.6/dist-packages/matplotlib/colors.py:512: RuntimeWarning: invalid value encountered in less\n",
            "  xa[xa < 0] = -1\n"
          ],
          "name": "stderr"
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<style  type=\"text/css\" >\n",
              "    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col0 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col1 {\n",
              "            background-color:  #ffc0cb;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col3 {\n",
              "            background-color:  #ffd5dc;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col4 {\n",
              "            background-color:  #ffdce2;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col5 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col0 {\n",
              "            background-color:  #ffe1e7;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col1 {\n",
              "            background-color:  #ffdee4;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col3 {\n",
              "            background-color:  #ffced7;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col4 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col5 {\n",
              "            background-color:  #ffd2da;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col0 {\n",
              "            background-color:  #ffdde3;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col1 {\n",
              "            background-color:  #ffc7d1;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col3 {\n",
              "            background-color:  #ffc7d1;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col4 {\n",
              "            background-color:  #ffcbd4;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col5 {\n",
              "            background-color:  #ffdde3;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col0 {\n",
              "            background-color:  #ffd9e0;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col1 {\n",
              "            background-color:  #ffc5cf;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col3 {\n",
              "            background-color:  #ffc6d0;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col4 {\n",
              "            background-color:  #ffcad3;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col5 {\n",
              "            background-color:  #ffced6;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col0 {\n",
              "            background-color:  #ffd5dc;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col1 {\n",
              "            background-color:  #ffdde3;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col3 {\n",
              "            background-color:  #ffc3cd;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col4 {\n",
              "            background-color:  #ffcdd6;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col5 {\n",
              "            background-color:  #ffd4db;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col0 {\n",
              "            background-color:  #ffd1d9;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col1 {\n",
              "            background-color:  #ffc1cc;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col3 {\n",
              "            background-color:  #ffc1cb;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col4 {\n",
              "            background-color:  #ffc7d1;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col5 {\n",
              "            background-color:  #ffc6d0;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col0 {\n",
              "            background-color:  #ffccd5;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col1 {\n",
              "            background-color:  #ffd3db;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col3 {\n",
              "            background-color:  #ffc0cb;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col4 {\n",
              "            background-color:  #ffe1e6;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col5 {\n",
              "            background-color:  #ffc0cb;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col0 {\n",
              "            background-color:  #ffc8d2;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col1 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col3 {\n",
              "            background-color:  #ffcbd4;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col4 {\n",
              "            background-color:  #ffd5dd;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col5 {\n",
              "            background-color:  #ffd1d9;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col0 {\n",
              "            background-color:  #ffc4ce;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col1 {\n",
              "            background-color:  #ffc1cb;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col3 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col4 {\n",
              "            background-color:  #ffc0cb;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col5 {\n",
              "            background-color:  #ffc6d0;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col0 {\n",
              "            background-color:  #ffc0cb;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col1 {\n",
              "            background-color:  #ffcdd6;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col2 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col3 {\n",
              "            background-color:  #ffd1d9;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col4 {\n",
              "            background-color:  #ffe5ea;\n",
              "            color:  #000000;\n",
              "        }    #T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col5 {\n",
              "            background-color:  #ffdbe2;\n",
              "            color:  #000000;\n",
              "        }</style><table id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >F</th>        <th class=\"col_heading level0 col1\" >E</th>        <th class=\"col_heading level0 col2\" >D</th>        <th class=\"col_heading level0 col3\" >C</th>        <th class=\"col_heading level0 col4\" >B</th>        <th class=\"col_heading level0 col5\" >A</th>    </tr></thead><tbody>\n",
              "                <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col0\" class=\"data row0 col0\" >1</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col1\" class=\"data row0 col1\" >1.32921</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col2\" class=\"data row0 col2\" >nan</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col3\" class=\"data row0 col3\" >-0.31628</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col4\" class=\"data row0 col4\" >-0.99081</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row0_col5\" class=\"data row0 col5\" >-1.07082</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col0\" class=\"data row1 col0\" >2</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col1\" class=\"data row1 col1\" >-1.43871</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col2\" class=\"data row1 col2\" >0.564417</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col3\" class=\"data row1 col3\" >0.295722</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col4\" class=\"data row1 col4\" >-1.6264</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row1_col5\" class=\"data row1 col5\" >0.219565</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col0\" class=\"data row2 col0\" >3</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col1\" class=\"data row2 col1\" >0.678805</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col2\" class=\"data row2 col2\" >1.88927</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col3\" class=\"data row2 col3\" >0.961538</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col4\" class=\"data row2 col4\" >0.104011</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row2_col5\" class=\"data row2 col5\" >-0.481165</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col0\" class=\"data row3 col0\" >4</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col1\" class=\"data row3 col1\" >0.850229</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col2\" class=\"data row3 col2\" >1.45342</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col3\" class=\"data row3 col3\" >1.05774</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col4\" class=\"data row3 col4\" >0.165562</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row3_col5\" class=\"data row3 col5\" >0.515018</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col0\" class=\"data row4 col0\" >5</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col1\" class=\"data row4 col1\" >-1.33694</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col2\" class=\"data row4 col2\" >0.562861</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col3\" class=\"data row4 col3\" >1.39285</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col4\" class=\"data row4 col4\" >-0.063328</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row4_col5\" class=\"data row4 col5\" >0.121668</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col0\" class=\"data row5 col0\" >6</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col1\" class=\"data row5 col1\" >1.2076</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col2\" class=\"data row5 col2\" >-0.00204021</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col3\" class=\"data row5 col3\" >1.6278</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col4\" class=\"data row5 col4\" >0.354493</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row5_col5\" class=\"data row5 col5\" >1.03753</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col0\" class=\"data row6 col0\" >7</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col1\" class=\"data row6 col1\" >-0.385684</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col2\" class=\"data row6 col2\" >0.519818</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col3\" class=\"data row6 col3\" >1.68658</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col4\" class=\"data row6 col4\" >-1.32596</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row6_col5\" class=\"data row6 col5\" >1.42898</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col0\" class=\"data row7 col0\" >8</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col1\" class=\"data row7 col1\" >-2.08935</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col2\" class=\"data row7 col2\" >-0.12982</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col3\" class=\"data row7 col3\" >0.631523</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col4\" class=\"data row7 col4\" >-0.586538</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row7_col5\" class=\"data row7 col5\" >0.29072</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row8\" class=\"row_heading level0 row8\" >8</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col0\" class=\"data row8 col0\" >9</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col1\" class=\"data row8 col1\" >1.2641</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col2\" class=\"data row8 col2\" >0.290035</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col3\" class=\"data row8 col3\" >-1.97029</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col4\" class=\"data row8 col4\" >0.803906</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row8_col5\" class=\"data row8 col5\" >1.03055</td>\n",
              "            </tr>\n",
              "            <tr>\n",
              "                        <th id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002level0_row9\" class=\"row_heading level0 row9\" >9</th>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col0\" class=\"data row9 col0\" >10</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col1\" class=\"data row9 col1\" >0.118098</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col2\" class=\"data row9 col2\" >-0.0218533</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col3\" class=\"data row9 col3\" >0.0468407</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col4\" class=\"data row9 col4\" >-1.62875</td>\n",
              "                        <td id=\"T_41b2d4c6_e847_11e9_9521_0242ac1c0002row9_col5\" class=\"data row9 col5\" >-0.392361</td>\n",
              "            </tr>\n",
              "    </tbody></table>"
            ],
            "text/plain": [
              "<pandas.io.formats.style.Styler at 0x7f046d68bba8>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 60
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "3cIAiFAsmxvJ",
        "colab_type": "code",
        "outputId": "a4bcdd75-9222-47c5-8264-068a7968d60f",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "class Disease:\n",
        "  def __init__(self, disease = 'Depression'):\n",
        "    self.type = disease\n",
        "    \n",
        "  def getName(self):\n",
        "    print(\"Mental Health Diseases: {0}\".format(self.type))\n",
        "\n",
        "d1 = Disease('Social Anxiety Disorder')\n",
        "d1.getName()"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Mental Health Diseases: Social Anxiety Disorder\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "3Nfj3YSbm905",
        "colab_type": "code",
        "outputId": "6acd1884-87cd-4de3-9fbf-e84b3d5a8d3c",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 51
        }
      },
      "source": [
        "try:\n",
        "  Value = int(input(\"Type a number between 1 and 10:\"))\n",
        "except ValueError:\n",
        "   print(\"You must type a number between 1 and 10!\")\n",
        "else:\n",
        "   if (Value > 0) and (Value <= 10):\n",
        "       print(\"You typed: \", Value)\n",
        "   else:\n",
        "       print(\"The value you typed is incorrect!\")"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Type a number between 1 and 10:333\n",
            "The value you typed is incorrect!\n"
          ],
          "name": "stdout"
        }
      ]
    }
  ]
}